package hdf5.gui.listeners;

import hdf5.gui.Player;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class StartActionListener implements ActionListener {

    private final StopActionListener listener;
    private Thread thread = new Thread();

    public StartActionListener(StopActionListener listener) {
        this.listener = listener;
    }

    public void actionPerformed(ActionEvent e) {
        if (!thread.isAlive()) {
            thread = new Thread(Player.getInstance());
            thread.start();
            listener.setThread(thread);
        }
    }
}
